﻿using System;
using System.Collections.Generic;
using System.IO;

namespace Xenta.Plugins
{
    /// <summary>
    /// Exposes the import/export format interface.
    /// </summary>
    /// <remarks>
    /// The interface allows to convert the data stream 
    /// of a specific format to a dictionary and back. 
    /// It is a base part of the import/export system.
    /// </remarks>
    public interface IImportExportFormat : IPlugin
    {
        #region Properties

        /// <summary>
        /// Gets the MIME type, which is supported 
        /// by the converter.
        /// </summary>
        string MimeType
        {
            get;
        }

        #endregion

        #region Methods

        /// <summary>
        /// Reads the collection of objects from a data stream.
        /// </summary>
        /// <param name="stream">The input data stream.</param>
        /// <returns>The collection of objects.</returns>
        IEnumerable<IDictionary<String, String>> Read(Stream stream);

        /// <summary>
        /// Writes the collection of objects to a data stream.
        /// </summary>
        /// <param name="stream">The output data stream.</param>
        /// <param name="collection">The input collection of objects.</param>
        void Write(Stream stream, IEnumerable<IDictionary<String, String>> collection);

        #endregion
    }
}
